//
//  AddressTableViewCell.m
//  ZiJinLian
//
//  Created by 🐛 on 2017/5/10.
//  Copyright © 2017年 lzy. All rights reserved.
//

#import "AddressTableViewCell.h"

@interface AddressTableViewCell()

@end

@implementation AddressTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    self.selectionStyle=0;
    self.accessoryType=UITableViewCellAccessoryDisclosureIndicator;
    self.addAddress.hidden=YES;
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}
-(void)setModel:(AcvAddressModel *)model
{
	_model = model;
	if (model == nil) {
		_nameLabel.hidden=YES;
		_phonelabel.hidden=YES;
		_addressLabel.hidden=YES;
		_addAddress.hidden=NO;
	}else{
		_nameLabel.hidden=NO;
		_phonelabel.hidden=NO;
		_addressLabel.hidden=NO;
		_addAddress.hidden=YES;
		_nameLabel.text = [NSString stringWithFormat:@"收货人:%@",model.consigneeName];
		_phonelabel.text = model.consigneePhone;
		NSString *str=[NSString stringWithFormat:@"%@%@",model.area,model.detail];
		if (model.isDefault == 1) {//默认
			NSMutableAttributedString *str2 = [[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:@"%@%@",@"[默认地址]",str]];
			[str2 addAttribute:NSForegroundColorAttributeName value:[UIColor redColor] range:NSMakeRange(0,6)];
			_addressLabel.attributedText=str2;
		}else{
			_addressLabel.text=[NSString stringWithFormat:@"收货地址:%@",str];
		}
	
	}
}
@end
